﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Obligatorio2013.Clases
{
    public class Price: IComparable
    {
        public double basicCost { get; set; }
        public double percent { get; set; }
        public double premiumCost { get; set; }
        // Para llevar un control de cambios.
        public DateTime changeDate { get; set; }


        #region constructors
        public Price(double c, double p, double sunday, int words)
        {
            this.basicCost = c;
            this.percent = p;
            this.premiumCost = c * (p / 100) + c;
            this.changeDate = DateTime.Today;
        }

        public Price() { this.changeDate = DateTime.Now; }

        #endregion

        public int CompareTo(object obj)
        {
            // Multiplico por -1 porque quiero ver la lista de precios descendente.
            Price p = obj as Price;
            return this.changeDate.CompareTo(p.changeDate)* -1;
        }
    }
}